package array;

public class Rotate {
    public static void main(String[] args) {
        int[] nums = {1, 2, 3, 4, 5, 6, 7};
        new Rotate().solution(nums, 3);
        for (int num : nums) {
            System.out.print(num+" ");
        }
    }
    public void solution(int[] nums, int k) {
        if (nums == null || nums.length == 0 || k == 0) {
            return;
        }
        int[] copy = nums.clone();
        for (int i = 0; i < nums.length; i++) {
            int newAdd = (i + 3) % nums.length;
            nums[newAdd] = copy[i];
        }
    }
}
